<? 
session_start();
if(!session_is_registered(uid)){
    echo "You have to login to view this page!</br></br>";
    echo "Click here to return to the "; 
    echo '<a href="./../index.php" title="Login">Login Page</a></br></br>';
    echo "Or sign up using this link ";
    echo '<a href="./../Registration/registration.html" title="Registration">Registration Page</a>';
exit();
}
else
    include 'equip.html';
  
    
    //Manual SQL Connection
    $con = mysql_connect("localhost", "root", "root") or die ( "Error connectiong to DB: ".mysql_error());
       
    mysql_select_db("reeferslog", $con) or die ( "Error selecting specific DB, reefeerslog: ".mysql_error());
    
    //Variables
    $media = $_POST['media'];
    $reactortype = $_POST['reactortype'];
    $manufacturer = $_POST['manufacturer'];
        
    //Date variables
    $day2 = $_POST['day2'];
    $month2 = $_POST['month2'];
    $year2 = $_POST['year2'];
    
    $day3 = $_POST['day3'];
    $month3 = $_POST['month3'];
    $year3 = $_POST['year3'];
    
    //Function to make a valid date input
    $mediainstalldate = $year2."-".$month2."-".$day2;
    $mediachangedate = $year3."-".$month3."-".$day3;
      
    //SQL Query to add tank info
    $addreactor = "insert into reactors (user_id,media,reactortype,date_installed,media_changed,manufacturer) values ('". $_SESSION['uid'] ."','$media','$reactortype','$mediainstalldate','$mediachangedate','$manufacturer')";

        //Execute Insert command
        if (!mysql_query($addreactor,$con))
            {
              die('Error: ' . mysql_error());
            }
            echo "Reactor added successfully!"; 
               
    //Close SQL input
    mysql_close($con);
?>